package top.continew.minithreadpool.policy;

import top.continew.minithreadpool.concurrent.ThreadPoolExecutor;

/**
 * 拒绝策略 - 调用者运行
 */
public class CallerRunsPolicy implements RejectedExecutionHandler {
    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        if (!executor.isShutdown()) {
            r.run();
        }
    }
}
